package com.sudao.android.candle;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Util {
	public static void openWebpage(Context ctx, String uri) {
		Intent intent = new Intent();

		intent.setAction(Intent.ACTION_VIEW).setData(Uri.parse(uri));
		ctx.startActivity(intent);
	}
	
	public static void openLocalPage(Context ctx, String uri) {
		Intent intent = new Intent(ctx, ReadLocalPageActivity.class);

		intent.setData(Uri.parse(uri));
		ctx.startActivity(intent);
	}

	public static void openLocalPage(Activity activity, String uri, int request) {
		Intent intent = new Intent(activity, ReadLocalPageActivity.class);

		intent.setData(Uri.parse(uri));
		activity.startActivityForResult(intent, request);
	}
}
